<?php
require_once('Mobile_Detect.php');
$detect = new Mobile_Detect();
?>
<div data-role="dialog" id="iframe" data-url="iframe" data-rel="external" data-ajax="false" data-dom-cache="true" class="gradient">
    <div data-role="content">
		<?php
		if ($detect->isTablet())
			echo('<iframe id="marketoForm" src="http://lp.google-mkto.com/APACGEODiscoverWeb_Form5.html" width="690" height="530" scrolling="no" frameborder="0"></iframe>');
		else 
			echo('<iframe id="marketoForm" src="http://lp.google-mkto.com/APACGEODiscoverWeb_Form4.html" width="221" height="740" scrolling="no" frameborder="0"></iframe>');
		?>

		<script type="text/javascript">
		_gaq.push(function() {
	    	var pageTracker = _gat._getTrackerByName();
	    	var allVars = $.getUrlVars();
	    	<?php
	    	printf('var marketoUrl = "http://lp.google-mkto.com/APACGEODiscoverWeb_Form%s.html";', $detect->isTablet() ? "5" : "4");
	    	?>
	    	if ($.getUrlVar('utm_source') != undefined)
			{
				marketoUrl += "?utm_source="+$.getUrlVar('utm_source');
				if ($.getUrlVar('utm_medium') != undefined) {
			    	marketoUrl += "&utm_medium="+$.getUrlVar('utm_medium');
				}
				if ($.getUrlVar('utm_term') != undefined) {
			    	marketoUrl += "&utm_term"+$.getUrlVar('utm_term');
				}
				if ($.getUrlVar('utm_content') != undefined) {
			    	marketoUrl += "&utm_content" + $.getUrlVar('utm_content');
				}
				if ($.getUrlVar('utm_campaign') != undefined) {
			    	marketoUrl += "&utm_campaign" + $.getUrlVar('utm_campaign');
				}
			}
			marketoUrl = pageTracker._getLinkerUrl(marketoUrl);
			$("#marketoForm").attr('src', marketoUrl);
    	});
		</script>
    </div>
</div>